package com.yuf.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.yuf.mapper.TbItemMapper;
import com.yuf.pojo.TbItem;
import com.yuf.pojo.TbItemExample;
import com.yuf.pojo.TbItemExample.Criteria;
import com.yuf.service.ItemService;
@Service
public class ItemServiceImpl implements ItemService{

	@Resource
	private TbItemMapper itemMapper;
	 
	@Override
	public TbItem selectOneById(long itemId) {
		// 设置根据查询条件查询
		TbItemExample ex = new TbItemExample();
		Criteria criteria = ex.createCriteria();
		//設置查詢條件
		criteria.andIdEqualTo(itemId);
		List<TbItem> list = itemMapper.selectByExample(ex);
		
		if(list != null && list.size() > 0) {
			return list.get(0);
		}
		return null;
	}

}
